#!/usr/bin/env python
# -*- coding: utf-8 -*-
#  utils.py
#  description

#  Created by zhouzongli633 on 2020/6/5 3:31 下午.
#  Copyright ©Intellectus All rights reserved.


import random
import string
import time


class CommonUtil():

    @staticmethod
    def getTimeRandomCode(type='', level='', len=3):
        t = time.time()
        timestamp = int(round(t / 100000))
        str_ben = (str(timestamp))
        str_end = ''.join(random.sample(string.ascii_letters + string.digits, len))
        return (str_ben + str_end).upper()

    @staticmethod
    def get_now_time_string(for_mate='%Y-%m-%d %H:%M:%S'):
        timestamp = time.time()
        time_struct = time.localtime(timestamp)
        return time.strftime(for_mate, time_struct)  # 2016-12-22 10:49:57

    @staticmethod
    def get_now_time_timestamp():
        timestamp = time.time()
        return str(round(timestamp))


if __name__ == '__main__':
    uuid_de = CommonUtil.getTimeRandomCode()
    print(uuid_de)
    print(type(uuid_de))
